<?php

App::uses('AppModel', 'Model');

class Group extends AppModel {
    public $name  = 'Group';
    public $order = 'Group.position';
    
    public $hasMany = array(
        'Product'
    );
    
    public function beforeSave($options=array()) {
        parent::beforeSave($options);
        
        if (isset($this->data['Group']['name'])) {
            $this->data['Group']['key'] = strtolower(urlize($this->data['Group']['name']));
        }
        return true;
    }
}

?>